import pymysql
from dbutils.pooled_db import PooledDB

POOl = PooledDB(
    creator=pymysql,
    maxconnections=0,
    mincached=0,
    blocking=False,
    host='localhost',
    port=3306,
    user='root',
    password='123456',
    database='db_zhaopin',
    charset='utf8'

)


def select(sql):
    conn = POOl.connection()
    cur = conn.cursor()
    cur.execute(sql)
    data = cur.fetchall()
    cur.close()
    conn.close()
    return data


def creat(sql):
    conn = POOl.connection()
    cur = conn.cursor()
    cur.execute(sql)
    data = cur.fetchall()
    cur.close()
    conn.close()


def save(sql, jobName, salary, min_salary, max_salary, degree, workExp, recruitNumber, workPlace, city, comName, industry, comSize):
    conn = POOl.connection()
    cur = conn.cursor()
    cur.execute(sql, (jobName, salary, min_salary, max_salary, degree, workExp, recruitNumber, workPlace, city, comName, industry, comSize))
    data = cur.fetchall()
    cur.close()
    conn.close()


